//
//  LXHistoryTableViewCell.m
//  喜马拉雅改良版框架
//
//  Created by liuxin on 15/12/31.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "LXHistoryTableViewCell.h"

@implementation LXHistoryTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews{
    self.userImage = [[UIImageView alloc]init];
    [self.contentView addSubview:self.userImage];
    [self.userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.offset(10);
        make.bottom.offset(-10);
        make.width.mas_equalTo(60);
    }];
    
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.font = [UIFont systemFontOfSize:17];
    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.userImage.mas_right).offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(10);
        make.height.mas_equalTo(20);
    }];
    
    self.subTitleLabel = [[UILabel alloc]init];
    self.subTitleLabel.numberOfLines = 0;
    self.subTitleLabel.textColor = [UIColor lightGrayColor];
    self.subTitleLabel.font = [UIFont systemFontOfSize:13];
    [self.contentView addSubview:self.subTitleLabel];
    [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).offset(5);
        make.left.equalTo(self.titleLabel);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(35);
    }];
}
-(void)setCellModel:(MusicDB *)cellModel{
    [self.userImage sd_setImageWithURL:[NSURL URLWithString:cellModel.headImage] placeholderImage:[UIImage imageNamed:ImagePlaceHolder]];
    self.titleLabel.text = cellModel.title;
    self.subTitleLabel.text = cellModel.albumTitle;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
